package com.free.explayer;

import android.content.Context;
import android.os.Binder;

import com.free.explayer.player.MusicPlayer;
import com.free.explayer.player.OnPlayPositionChangeListener;

public class MusicPlayerBinder extends Binder {

    private MusicPlayer mPlayer;
    private Context mContext;

    public MusicPlayerBinder(Context context) {
        mContext = context;
        mPlayer = new MusicPlayer(context);
    }

    public void init() {
        mPlayer.init();
    }

    public void preparePlay() {
        mPlayer.prepare();
    }

    public void play() {
        mPlayer.play();
    }

    public void pause() {
        mPlayer.pause();
    }

    public void seekTo(int progress) {
        mPlayer.seekTo(progress);
    }

    public void next() {}

    public void prev() {}

    public void stop() {}

    public void release() {}

    public boolean isPlaying() {
        return mPlayer.isPlaying();
    }

    public void setOnPlayPositionChangeListener(OnPlayPositionChangeListener listener) {
        mPlayer.setOnPlayPositionChangeListener(listener);
    }

    public int getDuration() {
        return mPlayer.getDuration();
    }
}
